package com.brian.springsecurity.service.impl;

import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.stereotype.Service;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @program: architect
 * @author: Brian Huang
 * @create: 2019-08-06 07
 **/
@Service
public class UserAuthenticationFailed implements AuthenticationFailureHandler {


    //用户认证失败
    @Override
    public void onAuthenticationFailure(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException, ServletException {
        httpServletResponse.sendRedirect("xuduocloud.com");
    }
}
